package com.leetcode.LC;

public class LC485 {
    public int findMaxConsecutiveOnes(int[] nums) {
        int res = 0;
        for (int l = 0, r = 0; r < nums.length; r++) {
            if (nums[r] == 0) {
                l = r + 1;
            }
            res = Math.max(res, r - l + 1);
        }
        return res;
    }

    public static void main(String[] args) {
        System.out.println(new LC485().findMaxConsecutiveOnes(new int[]{1, 1, 0, 1, 1, 1}));
    }
}
